<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>被照护人管理 - 邦伴用户端</title>
  <link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
  <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css" rel="stylesheet">
  <style>
    :root {
      --primary: #ff7e2d;
      --primary-light: #fff3ea;
      --border: #f0f0f0;
      --text-main: #222;
      --text-sub: #888;
    }
    
    body {
      font-family: 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
      background-color: #f8f8f8;
      color: var(--text-main);
    }
    
    .app-container {
      width: 375px;
      height: 812px;
      margin: 0 auto;
      background: #fff;
      position: relative;
      box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);
      overflow-y: auto;
    }
    
    .primary-color {
      color: var(--primary);
    }
    
    .primary-bg {
      background-color: var(--primary);
    }
    
    .primary-light-bg {
      background-color: var(--primary-light);
    }
    
    .btn-primary {
      background-color: var(--primary);
      color: white;
    }
    
    .btn-outline {
      border: 1px solid var(--primary);
      color: var(--primary);
    }
    
    .card {
      border-radius: 12px;
      box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    }
    
    .avatar {
      width: 60px;
      height: 60px;
      border-radius: 50%;
      background-color: var(--primary-light);
      display: flex;
      align-items: center;
      justify-content: center;
      color: var(--primary);
      font-size: 24px;
      font-weight: bold;
      margin-right: 16px;
      flex-shrink: 0;
    }
    
    .tag {
      display: inline-block;
      padding: 2px 8px;
      border-radius: 4px;
      font-size: 12px;
      margin-right: 8px;
    }
    
    .tag-primary {
      background-color: var(--primary-light);
      color: var(--primary);
    }
    
    .tag-gray {
      background-color: #f3f4f6;
      color: var(--text-sub);
    }
    
    .empty-state {
      padding: 40px 0;
      text-align: center;
    }
    
    .empty-icon {
      width: 80px;
      height: 80px;
      border-radius: 50%;
      background-color: #f3f4f6;
      display: flex;
      align-items: center;
      justify-content: center;
      margin: 0 auto 16px;
      color: #d1d5db;
      font-size: 32px;
    }
  </style>
</head>
<body>
  <div class="app-container">
    <!-- 顶部导航栏 -->
    <div class="sticky top-0 z-10 bg-white border-b border-gray-100 px-4 py-3 flex items-center">
      <a href="javascript:history.back()" class="mr-2">
        <i class="fas fa-arrow-left text-lg"></i>
      </a>
      <h1 class="text-lg font-medium flex-1 text-center">被照护人管理</h1>
      <a href="care_recipient_add.html" class="ml-2">
        <i class="fas fa-plus text-lg"></i>
      </a>
    </div>
    
    <!-- 被照护人列表 -->
    <div class="p-4">
      <!-- 被照护人卡片1 -->
      <div class="card bg-white p-4 mb-4">
        <div class="flex">
          <div class="avatar">张</div>
          <div class="flex-1">
            <div class="flex items-center justify-between mb-1">
              <h3 class="font-medium">张爷爷</h3>
              <div class="flex">
                <a href="care_recipient_edit.html?id=1" class="text-gray-400 mr-3">
                  <i class="fas fa-edit"></i>
                </a>
                <button class="text-gray-400 delete-btn" data-id="1">
                  <i class="fas fa-trash-alt"></i>
                </button>
              </div>
            </div>
            <div class="text-sm text-gray-500 mb-2">男 | 78岁 | 身份证：3101********1234</div>
            <div class="flex flex-wrap">
              <span class="tag tag-primary">默认</span>
              <span class="tag tag-gray">高血压</span>
              <span class="tag tag-gray">糖尿病</span>
            </div>
          </div>
        </div>
      </div>
      
      <!-- 被照护人卡片2 -->
      <div class="card bg-white p-4 mb-4">
        <div class="flex">
          <div class="avatar">王</div>
          <div class="flex-1">
            <div class="flex items-center justify-between mb-1">
              <h3 class="font-medium">王奶奶</h3>
              <div class="flex">
                <a href="care_recipient_edit.html?id=2" class="text-gray-400 mr-3">
                  <i class="fas fa-edit"></i>
                </a>
                <button class="text-gray-400 delete-btn" data-id="2">
                  <i class="fas fa-trash-alt"></i>
                </button>
              </div>
            </div>
            <div class="text-sm text-gray-500 mb-2">女 | 75岁 | 身份证：3101********5678</div>
            <div class="flex flex-wrap">
              <span class="tag tag-gray">关节炎</span>
              <span class="tag tag-gray">骨质疏松</span>
            </div>
          </div>
        </div>
      </div>
      
      <!-- 被照护人卡片3 -->
      <div class="card bg-white p-4">
        <div class="flex">
          <div class="avatar">李</div>
          <div class="flex-1">
            <div class="flex items-center justify-between mb-1">
              <h3 class="font-medium">李叔叔</h3>
              <div class="flex">
                <a href="care_recipient_edit.html?id=3" class="text-gray-400 mr-3">
                  <i class="fas fa-edit"></i>
                </a>
                <button class="text-gray-400 delete-btn" data-id="3">
                  <i class="fas fa-trash-alt"></i>
                </button>
              </div>
            </div>
            <div class="text-sm text-gray-500 mb-2">男 | 65岁 | 身份证：3101********9012</div>
            <div class="flex flex-wrap">
              <span class="tag tag-gray">中风康复</span>
            </div>
          </div>
        </div>
      </div>
      
      <!-- 添加被照护人按钮 -->
      <div class="mt-6">
        <a href="care_recipient_add.html" class="block w-full py-3 btn-outline text-center rounded-lg">
          <i class="fas fa-plus mr-2"></i>添加被照护人
        </a>
      </div>
      
      <!-- 空状态 (默认隐藏) -->
      <div class="empty-state hidden">
        <div class="empty-icon">
          <i class="fas fa-user-friends"></i>
        </div>
        <p class="text-gray-500 mb-6">暂无被照护人信息</p>
        <a href="care_recipient_add.html" class="px-6 py-2 btn-primary rounded-lg">
          添加被照护人
        </a>
      </div>
    </div>
    
    <!-- 删除确认弹窗 -->
    <div id="deleteModal" class="fixed inset-0 bg-black bg-opacity-50 hidden flex items-center justify-center z-50">
      <div class="bg-white rounded-lg w-72 overflow-hidden">
        <div class="p-4 text-center">
          <h3 class="font-medium mb-2">确认删除</h3>
          <p class="text-sm text-gray-500">确定要删除此被照护人信息吗？</p>
        </div>
        <div class="flex border-t border-gray-100">
          <button id="cancelDelete" class="flex-1 py-3 text-center text-gray-500">取消</button>
          <button id="confirmDelete" class="flex-1 py-3 text-center text-red-500">删除</button>
        </div>
      </div>
    </div>
  </div>

  <script>
    document.addEventListener('DOMContentLoaded', function() {
      // 删除功能
      const deleteButtons = document.querySelectorAll('.delete-btn');
      const deleteModal = document.getElementById('deleteModal');
      const cancelDelete = document.getElementById('cancelDelete');
      const confirmDelete = document.getElementById('confirmDelete');
      let currentDeleteId = null;
      
      deleteButtons.forEach(button => {
        button.addEventListener('click', function() {
          currentDeleteId = this.dataset.id;
          deleteModal.classList.remove('hidden');
          deleteModal.classList.add('flex');
        });
      });
      
      cancelDelete.addEventListener('click', function() {
        deleteModal.classList.add('hidden');
        deleteModal.classList.remove('flex');
        currentDeleteId = null;
      });
      
      confirmDelete.addEventListener('click', function() {
        if (currentDeleteId) {
          // 这里可以添加AJAX请求来删除被照护人
          console.log('删除被照护人ID:', currentDeleteId);
          
          // 从DOM中移除对应的卡片
          const cardToRemove = document.querySelector(`.delete-btn[data-id="${currentDeleteId}"]`).closest('.card');
          cardToRemove.remove();
          
          // 检查是否还有被照护人卡片
          const remainingCards = document.querySelectorAll('.card');
          if (remainingCards.length === 0) {
            document.querySelector('.empty-state').classList.remove('hidden');
          }
        }
        
        deleteModal.classList.add('hidden');
        deleteModal.classList.remove('flex');
        currentDeleteId = null;
      });
      
      // 点击弹窗外部关闭
      deleteModal.addEventListener('click', function(e) {
        if (e.target === deleteModal) {
          cancelDelete.click();
        }
      });
    });
  </script>
</body>
</html> 